package smcms.commons.api.entity.result;

import lombok.Data;

@Data
public class CommonsResult<T> {
    private Integer code;
    private String msg;
    private T data;

    public CommonsResult() {
    }

    public CommonsResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public CommonsResult(Integer code, String msg)
    {
        this(code,msg,null);
    }

    public CommonsResult success( T data )
    {
        return new CommonsResult(200,"成功",data);
    }

    public CommonsResult success( )
    {
        return new CommonsResult(200,"成功");
    }

    public CommonsResult failed(String msg){
        return new CommonsResult(-9999,msg);
    }

}
